import { createRouter, createWebHistory } from 'vue-router'
import User from '../views/User.vue'
import Login from "@/views/Login";
import Layout from "@/Layout/Layout";
import Register from "@/views/Register";
import Person from "@/views/Person";
import Book from "@/views/Book";
import News from "../views/News";

const routes = [
  {
    path: '/',
    redirect: "/login",
    name: 'Layout',
    component: Layout,
    children: [
      {
        path: '/user',
        name: 'User',
        component: User,
      },
      {
        path: '/book',
        name: 'Book',
        component: Book,
      },
      {
        path: '/person',
        name: 'Person',
        component: Person,
      },
      {
        path: '/news',
        name: 'News',
        component: News,
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router
